<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue3响应式实现</title>
</head>
<body>
    <div class="app">
        hello <br/>
        <div class="vue3"></div>
    </div>
    <script>
        let data = {
            msg: 'hello'
        }
        let vm = new Proxy(data,{
            get(target,key) {
                return target[key];
            },
            set(target,key,newVal) {
                if(target[key] === newVal){ return}
                target[key] = newVal;
                document.querySelector('.vue3').textContent = target[key];
            }
        })

        vm.msg = 'hello world!'
    </script>
</body>
</html>